package cp3120.view;

import cp3120.dao.DAOFactory;
import cp3120.model.User;
import generic.swing.ListView;
import java.util.List;

/**
 *
 * @author Adam Scarr <scarr.adam@gmail.com>
 */
public class UserListView extends ListView<User> {

    public UserListView() {
        setTitle("User Manager");
    }

    protected List<User> getList() {
        return DAOFactory.getUserDAO().getUsers();
    }

    protected void delete(User user) {
        DAOFactory.getUserDAO().deleteUser(user);
    }

    protected void edit(User user) {
        new UserEditor(user).setVisible(true);
    }

    protected void add() {
        new UserEditor(new User()).setVisible(true);
    }

    protected void ok() {
        dispose();
    }
}
